package com.vvlive.caibao.smartcity.utils.sort;

import java.text.Collator;
import java.util.Comparator;

public class CustomSortComparator implements Comparator<Name> {

	private Collator cmp;

	public CustomSortComparator() {
		cmp = Collator.getInstance(java.util.Locale.CHINA);
	}

	@Override
	public int compare(Name n1, Name n2) {
		if (cmp.compare(n1.getOriginal(), n2.getOriginal()) > 0) {
			return 1;
		} else if (cmp.compare(n1.getOriginal(), n2.getOriginal()) < 0) {
			return -1;
		}
		return 0;
	}
}